<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <h:head>
        <title>notifications</title>
        <style>@import url("../resources/css/homepageCSS1.css")</style>
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            
            <p:layoutUnit styleClass="topLayout" position="north" size="100" resizable="true">
                <img id="titleImg" src="../resources/images/titolo90.png" alt="METEOCAL"/>
                <div id="userBlock">
                    <h:form>
                        <p:outputLabel>
                            #{userBean.name}&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:link style="color: blue;" value="Home" outcome="home?faces-redirect=true"/>
                        <p:outputLabel>
                            &nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:commandLink style="color: blue;" action="#{loginBean.logout()}" value="Logout"/>
                    </h:form>
                </div>
            </p:layoutUnit>
            
            <p:layoutUnit styleClass="centralBlock" position="center">
                <h:form>
                    <p:dataList emptyMessage="No messages." paginatorAlwaysVisible="false" paginatorPosition="bottom" value="#{messageBean.sentMessages}" var="message" type="unordered" itemType="none" paginator="true" rows="10" styleClass="paginated">
                        <f:facet name="header">
                            Notifications
                        </f:facet>
                        <p:panel style="padding: 0px; margin-right: 40px; margin-top: 2px; background: #{messageBean.color(message)}">
                            <table width="100%">
                                <tr>
                                    <td width="20%">
                                        <h:outputLabel value="#{message.message1.timestamp}">
                                            <f:convertDateTime pattern="MM/dd/yyyy &nbsp;&nbsp;&nbsp; HH:mm:ss" timeZone="GMT+1"/>
                                        </h:outputLabel>
                                    </td>
                                    <td width="30%">
                                        Message for event <h:commandLink value="#{message.message1.event.title}" action="#{messageBean.readMessage(message)}"/>:
                                    </td>
                                    <td>
                                        #{messageBean.printMessage(message.message1)}
                                    </td>
                                </tr>
                            </table>
                        </p:panel>
                    </p:dataList>
                </h:form>
            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

